home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97b.txt / 000004_icon-group-sender _Fri Jun 27 10:54:19 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 27 Jun 1997 12:36:24 MST
  2. Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
  3.     id AA18215; Fri, 27 Jun 1997 12:36:24 -0700
  4. Date: Fri, 27 Jun 1997 10:54:19 -0700
  5. From: Gregg Townsend <gmt>
  6. Message-Id: <9706271754.AA10927@hawk.CS.Arizona.EDU>
  7. To: icon-group
  8. Subject: Re: Process ID availability
  9. Cc: lane@mcc.com
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11. Status: RO
  12.  
  13. If your Icon platform supports loadable C functions, you can call the
  14. getpid() function that's in the Icon Program Library.  If you installed
  15. the Icon Starter Kit (prebuilt binaries) for Solaris, SunOS, Linux,
  16. Digital Unix, or Irix, the function is immediately available for linking:
  17.  
  18.     link cfunc
  19.  
  20.     procedure main()
  21.        write(getpid())
  22.     end
  23.  
  24. Reading from a pipe is another approach.  On systems where the Korn Shell
  25. (ksh) is available, the pipe program can be simplified to this:
  26.  
  27.     procedure main()
  28.        write(readpid())
  29.     end
  30.  
  31.     procedure readpid()
  32.        pipe := open("exec ksh -c 'echo $PPID'","pr")
  33.        pid := integer(read(pipe))
  34.        close(pipe)
  35.        return pid
  36.     end
  37.  
  38. -----------------------------------------------------------------------------
  39.    Gregg Townsend              Gould-Simpson Building   gmt@cs.arizona.edu
  40.    Staff Scientist             1040 E. 4th St.          32 13 45N  110 57 16W
  41.    Dept. of Computer Science   PO Box 210077            tel: +1 520 621 4325
  42.    The University of Arizona   Tucson, AZ  85721-0077   fax: +1 520 621 4246
  43.